<!--
- @founder   IT柏拉图, https: //weibo.com/itprato
- @author    DedeCMS团队
- @copyright Copyright (c) 2007 - 2021, 上海卓卓网络科技有限公司 (DesDev, Inc.)
--->

{dede:config.pagesize value="30"/}
<html>
<head>
<meta charset="{dede:global.cfg_soft_lang/}" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>联动枚举管理</title>
<meta name="copyright" content="2007-2021 DedeCMS, 上海卓卓网络科技有限公司 (DesDev, Inc.)" />
<link rel="icon" href="/favicon.ico" />
<!-- CSS FILES -->
<link rel="stylesheet" type="text/css" href="{dede:global.cfg_assets_dir/}/pkg/uikit/css/uikit.min.css" />
<link rel="stylesheet" type="text/css" href="{dede:global.cfg_assets_dir/}/css/manage.dede.css">
</head>
<body>
<div id="Table_Header_202X2W2X1X292F" class="uk-card uk-card-small uk-card-default" uk-sticky="bottom: #offset">
<div id="Header_1W2T2S2T1V252B" class="uk-card-header">
<div class="uk-grid uk-grid-small uk-text-small">
<span><ul class="uk-breadcrumb"><li><a href="stepselect_main.php"><span>联动枚举管理</span></a></li>
<?php
$selgroup = '';
foreach($etypes as $arr)
{
$stylecolor = "";
if($arr['issystem']==1) $stylecolor = " style='color:#999999' ";
if($egroup === $arr['egroup']) {
$selgroup = $arr['itemname'];
echo "<li><span>{$selgroup}</span></li>";
}
}
?>
</ul>
</span>
</div>
<ul class="uk-navbar-nav dede-card-navbar" uk-navbar >
<li><a href="stepselect_main.php?action=upallcache" class="uk-button uk-button-default uk-button-small uk-flex-inline ">更新所有枚举缓存</a></li>
</ul>
</div>
<table id="dede-table-toolbar" class="uk-table uk-table-middle uk-table-divider uk-table-striped uk-margin-remove">
<thead>
<?php if(!empty($egroup)) {?>
<tr>
<td width="6%">ID</td>
<td width="6%"></td>
<td>枚举名</td>
<td width="10%">类别组名</td>
<td width="10%">枚举类型</td>
<td width="10%">枚举值</td>
<td width="10%">组内排序</td>
<td width="18%">操作</td>
</tr>
<?php }else{ ?>
<tr>
<td width="6%">ID</td>
<td width="6%"></td>
<td width="28%">组类别名</td>
<td width="10%">级数</td>
<td width="10%">系统</td>
<td width="15%">缓存组名</td>
<td>操作</td>
</tr>
<?php }?>
</thead>
</table>
</div>
<div id="Table_Body_1X2V2U2V1W272D" class="uk-card uk-card-small uk-card-default" style="top: -50;">
<div class="uk-card-body uk-overflow-auto" grid>
<div class="uk-child-width-1-1">
<div class="uk-overflow-auto">
<table class="uk-table uk-table-hover uk-table-middle uk-table-divider uk-table-striped uk-margin-remove">
<?php
if(!empty($egroup))
{
$arr = $dsql->GetOne("SELECT * FROM `#@__stepselect` WHERE egroup='{$egroup}' ");
$dsql->Execute('out',"SELECT evalue,ename FROM `#@__sys_enum` WHERE egroup='{$arr['egroup']}' ORDER BY disorder ASC,evalue ASC");
$options = '';
while($row1 = $dsql->GetArray('out'))
{
if(!preg_match("#\.#", $row1['evalue']))
{
$row1['ename'] = ($row1['evalue'] % 500 == 0)? $row1['ename'] : '└─'.$row1['ename'];
if($topvalue != $row1['evalue']) $options .= "<option value='{$row1['evalue']}'>{$row1['ename']}</option>\r\n";
else $options .= "<option value='{$row1['evalue']}' selected='selected'>{$row1['ename']}</option>\r\n";
}
}
// 如果添加3级之类
if($topvalue % 500 != 0) $arr['issign'] = 2;
?>
<thead>
<tr>
<td width="6%">ID</td>
<td width="6%"></td>
<td>枚举名</td>
<td width="10%">类别组名</td>
<td width="10%">枚举类型</td>
<td width="10%">枚举值</td>
<td width="10%">组内排序</td>
<td width="18%">操作</td>
</tr>
</thead>
<tbody>
<!-- 内容列表 -->
{dede:datalist}
<tr>
<td>{dede:field.id /}</td>
<td><input type='checkbox' name='ids[]' value='{dede:field.id /}' class='uk-checkbox' /></td>
<td>
<?php if(!preg_match("#\.#", $fields['evalue'])) {
if($fields['evalue']>500 && $fields['evalue']%500 != 0) $fields['ename'] = " └─".$fields['ename'];
} else {
$fields['ename'] = " └───".$fields['ename'];
} ?>
<input type='text' id='ename{dede:field.id/}' value='{dede:field.ename /}' class='uk-input uk-form-width-medium uk-form-small' />
</td>
<td>{dede:field.egroup /}</td>
<td>
<?php
if(!preg_match("#\.#", $fields['evalue'])) {
if($fields['evalue']>500 && $fields['evalue']%500 != 0) echo '二级选择';
else echo '一级选择';
} else {
echo "三级选择";
} ?>
</td>
<td>{dede:field.evalue /}</td>
<td><input type='text' id='disorder{dede:field.id/}' value='{dede:field.disorder /}' class='uk-input uk-form-width-small uk-form-small' /></td>
<td>
<?php if(!empty($egroup)) { ?>
<a href='javascript:updateItem({dede:field.id/});'>[更新]</a>
<a href='stepselect_main.php?action=delenum&id={dede:field.id/}'>[删除]</a>
<?php } else {
echo "<a href='stepselect_main.php?egroup={$fields['egroup']}'><u>".$egroups[$fields['egroup']]."</u></a>";
} ?>
</td>
</tr>
{/dede:datalist}
<!-- /内容列表 -->
</tbody>
<!-- 批量操作 -->
<thead>
<tr>
<td></td>
<td><input type="checkbox" id="select-all" class="uk-checkbox" /></td>
<td height="36" colspan="5">
<a href="#" onClick="document.form1.submit();" class="uk-button uk-button-default uk-button-small">删除所选</a>
</td>
</tr>
</thead>
<!-- /批量操作 -->
<?php }else{?>
<thead>
<tr>
<td width="6%">ID</td>
<td width="6%"></td>
<td width="28%">组类别名</td>
<td width="10%">级数</td>
<td width="10%">系统</td>
<td width="15%">缓存组名</td>
<td>操作</td>
</tr>
</thead>
<tbody>
<!-- 内容列表 -->
{dede:datalist}
<tr>
<td> {dede:field.id /} </td>
<td><input type='checkbox' name='ids[]' value='{dede:field.id /}' class='uk-checkbox' /></td>
<td> <a href='stepselect_main.php?egroup={dede:field.egroup /}'><u>{dede:field.itemname /}</u></a> </td>
<td>
<?php
switch ($fields['issign']) {
case 0:
echo "一级选择";
break;
case 1:
echo "二级选择";
break;
case 2:
echo "三级选择";
break;
}
?>
</td>
<td> {dede:field.issystem function="@me==1 ? '是' : '否'" /} </td>
<td>{dede:field.egroup /}</td>
<td>
<a href='stepselect_main.php?action=upallcache&egroup={dede:field.egroup /}'>[更新缓存]</a>
<a href='stepselect_main.php?egroup={dede:field.egroup /}'>[查看子分类]</a>
</td>
</tr>
{/dede:datalist}
<!-- /内容列表 -->
</tbody>
<?php }?>
<!-- 分页 -->
<thead>
<tr>
<td height="36" colspan="10" align="center">
{dede:pagelist listsize=6/}
</td>
</tr>
</thead>
<!-- /分页 -->
</table>
</div>
</div>
</div>
</div>
<div class="bar-bottom uk-flex uk-light uk-flex-right">
<div class="uk-button-group" style="margin-left: 50px;">
</div>
<div class="e1e02">Copyright &copy; 2007-2021 <a href='http://www.dedecms.com' target='_blank'><u>DedeCMS</u></a>, 上海卓卓网络科技有限公司 (DesDev, Inc.)</div>
</div>
<!-- JS FILES -->
<script src="{dede:global.cfg_assets_dir/}/pkg/uikit/js/uikit.min.js"></script>
<script src="{dede:global.cfg_assets_dir/}/pkg/uikit/js/uikit-icons.min.js"></script>
<script src="{dede:global.cfg_assets_dir/}/pkg/jquery/jquery.min.js"></script>
<script src="{dede:global.cfg_assets_dir/}/js/dede.manage.min.js"></script>
<SCRIPT LANGUAGE="JavaScript">
var loadhtml = "<center><img src='../assets/img/loadinglit.gif' style='padding:30px' /></center>";
function updateItem(aid) {
var upenumf = document.getElementById('upenumf');
upenumf.ename.value = $DE('ename' + aid).value;
upenumf.disorder.value = $DE('disorder' + aid).value;
upenumf.aid.value = aid;
upenumf.submit();
}
function GetSelType() {
var selvalue = $DE('egroup1').options[$DE('egroup1').selectedIndex].value;
return selvalue;
}
function AddType() {
var myajax = new DedeAjax($DE('edsta'));
$DE('edsta').style.display = 'block';
myajax.SendGet('stepselect_main.php?action=addnew', true, true, '', '系统错误，无法获取数据！', loadhtml);
}
function AddEnum() {
var id = GetSelType();
if (id == 0) {
alert("必须选择一个类别！");
return false;
}
var myajax = new DedeAjax($DE('edsta'));
$DE('edsta').style.display = 'block';
myajax.SendGet('stepselect_main.php?action=addenum&id=' + id, true, true, '', '系统错误，无法获取数据！', loadhtml);
}
function EditType() {
var id = GetSelType();
if (id == 0) {
alert("必须选择一个类别！");
return false;
}
var myajax = new DedeAjax($DE('edsta'));
$DE('edsta').style.display = 'block';
myajax.SendGet('stepselect_main.php?action=edit&id=' + id, true, true, '', '系统错误，无法获取数据！', loadhtml);
}
function ViewType() {
var id = GetSelType();
if (id == 0) {
alert("必须选择一个类别！");
return false;
}
var myajax = new DedeAjax($DE('edsta'));
$DE('edsta').style.display = 'block';
myajax.SendGet('stepselect_main.php?action=view&id=' + id, true, true, '', '系统错误，无法获取数据！', loadhtml);
}
function DelType() {
if (window.confirm("你确实要删除这个分类吗？") == false) return false;
var id = GetSelType();
if (id == 0) {
alert("必须选择一个类别！");
return false;
}
location.href = 'stepselect_main.php?action=del&id=' + id;
}
function CloseTWin() {
$DE('edsta').innerHTML = loadhtml;
$DE('edsta').style.display = 'none';
}
function ChangePage(sobj) {
var ntxt = sobj.options[sobj.selectedIndex].text;
if (sobj.options[sobj.selectedIndex].value == 0) {
location.href = 'stepselect_main.php';
}
else {
var ns = ntxt.split('|');
location.href = 'stepselect_main.php?egroup=' + ns[0];
}
}
function TogSel() {
var ems = document.getElementsByName('ids[]');
for (i = 0; i < ems.length; i++) {
if (ems[i].checked == false) ems[i].checked = true;
else ems[i].checked = false;
}
}
function DelSel() {
if (window.confirm("你确实要删除这些分类吗？")) document.form1.submit();
}
function ChangePage2(sobj) {
var nv = sobj.options[sobj.selectedIndex].value;
if (sobj.options[sobj.selectedIndex].value == 0) {
location.href = 'stepselect_main.php?egroup=<?php echo $egroup; ?>';
}
else {
location.href = 'stepselect_main.php?egroup=<?php echo $egroup; ?>&topvalue=' + nv;
}
}
</SCRIPT>
</body>
</html>
